

<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
  <meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>pymatgen.io.lammps package &mdash; pymatgen 2025.6.14 documentation</title>
      <link rel="stylesheet" type="text/css" href="assets/pygments.css?v=03e43079" />
      <link rel="stylesheet" type="text/css" href="assets/css/theme.css?v=e59714d7" />
      <link rel="stylesheet" type="text/css" href="assets/css/custom.css" />

  
    <link rel="canonical" href="https://pymatgen.orgpymatgen.io.lammps.html"/>
      <script src="assets/jquery.js?v=5d32c60e"></script>
      <script src="assets/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
      <script src="assets/documentation_options.js?v=03bec786"></script>
      <script src="assets/doctools.js?v=9bcbadda"></script>
      <script src="assets/sphinx_highlight.js?v=dc90522c"></script>
    <script src="assets/js/theme.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" /> 
</head>

<body class="wy-body-for-nav"> 
  <div class="wy-grid-for-nav">
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: linear-gradient(0deg, rgba(23,63,162,1) 0%, rgba(0,70,192,1) 100%)" >

          
          
          <a href="index.html">
            
          </a>
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>
        </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
              <!-- Local TOC -->
              <div class="local-toc"><ul>
<li><a class="reference internal" href="#">pymatgen.io.lammps package</a><ul>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-pymatgen.io.lammps.data">pymatgen.io.lammps.data module</a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData"><code class="docutils literal notranslate"><span class="pre">CombinedData</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData.as_lammpsdata"><code class="docutils literal notranslate"><span class="pre">CombinedData.as_lammpsdata()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData.disassemble"><code class="docutils literal notranslate"><span class="pre">CombinedData.disassemble()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData.from_ff_and_topologies"><code class="docutils literal notranslate"><span class="pre">CombinedData.from_ff_and_topologies()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData.from_files"><code class="docutils literal notranslate"><span class="pre">CombinedData.from_files()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData.from_lammpsdata"><code class="docutils literal notranslate"><span class="pre">CombinedData.from_lammpsdata()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData.from_structure"><code class="docutils literal notranslate"><span class="pre">CombinedData.from_structure()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData.get_str"><code class="docutils literal notranslate"><span class="pre">CombinedData.get_str()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData.parse_xyz"><code class="docutils literal notranslate"><span class="pre">CombinedData.parse_xyz()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData.structure"><code class="docutils literal notranslate"><span class="pre">CombinedData.structure</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.ForceField"><code class="docutils literal notranslate"><span class="pre">ForceField</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.ForceField.masses"><code class="docutils literal notranslate"><span class="pre">ForceField.masses</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.ForceField.force_fieldct"><code class="docutils literal notranslate"><span class="pre">ForceField.force_fieldct</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.ForceField.maps"><code class="docutils literal notranslate"><span class="pre">ForceField.maps</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.ForceField.from_dict"><code class="docutils literal notranslate"><span class="pre">ForceField.from_dict()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.ForceField.from_file"><code class="docutils literal notranslate"><span class="pre">ForceField.from_file()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.ForceField.to_file"><code class="docutils literal notranslate"><span class="pre">ForceField.to_file()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox"><code class="docutils literal notranslate"><span class="pre">LammpsBox</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox.get_box_shift"><code class="docutils literal notranslate"><span class="pre">LammpsBox.get_box_shift()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox.get_str"><code class="docutils literal notranslate"><span class="pre">LammpsBox.get_str()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox.to_lattice"><code class="docutils literal notranslate"><span class="pre">LammpsBox.to_lattice()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox.volume"><code class="docutils literal notranslate"><span class="pre">LammpsBox.volume</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData"><code class="docutils literal notranslate"><span class="pre">LammpsData</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData.disassemble"><code class="docutils literal notranslate"><span class="pre">LammpsData.disassemble()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData.from_ff_and_topologies"><code class="docutils literal notranslate"><span class="pre">LammpsData.from_ff_and_topologies()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData.from_file"><code class="docutils literal notranslate"><span class="pre">LammpsData.from_file()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData.from_structure"><code class="docutils literal notranslate"><span class="pre">LammpsData.from_structure()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData.get_str"><code class="docutils literal notranslate"><span class="pre">LammpsData.get_str()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData.set_charge_atom"><code class="docutils literal notranslate"><span class="pre">LammpsData.set_charge_atom()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData.set_charge_atom_type"><code class="docutils literal notranslate"><span class="pre">LammpsData.set_charge_atom_type()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData.structure"><code class="docutils literal notranslate"><span class="pre">LammpsData.structure</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData.write_file"><code class="docutils literal notranslate"><span class="pre">LammpsData.write_file()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.Topology"><code class="docutils literal notranslate"><span class="pre">Topology</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.Topology.from_bonding"><code class="docutils literal notranslate"><span class="pre">Topology.from_bonding()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.data.lattice_2_lmpbox"><code class="docutils literal notranslate"><span class="pre">lattice_2_lmpbox()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-pymatgen.io.lammps.generators">pymatgen.io.lammps.generators module</a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.template"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.template</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.calc_type"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.calc_type</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.settings"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.settings</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.keep_stages"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.keep_stages</span></code></a></li>
<li><a class="reference internal" href="#id0"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.calc_type</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.data"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.data</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.get_input_set"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.get_input_set()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.inputfile"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.inputfile</span></code></a></li>
<li><a class="reference internal" href="#id1"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.keep_stages</span></code></a></li>
<li><a class="reference internal" href="#id2"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.settings</span></code></a></li>
<li><a class="reference internal" href="#id3"><code class="docutils literal notranslate"><span class="pre">BaseLammpsGenerator.template</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.LammpsMinimization"><code class="docutils literal notranslate"><span class="pre">LammpsMinimization</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.LammpsMinimization.atom_style"><code class="docutils literal notranslate"><span class="pre">LammpsMinimization.atom_style</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.LammpsMinimization.boundary"><code class="docutils literal notranslate"><span class="pre">LammpsMinimization.boundary</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.LammpsMinimization.dimension"><code class="docutils literal notranslate"><span class="pre">LammpsMinimization.dimension</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.LammpsMinimization.force_field"><code class="docutils literal notranslate"><span class="pre">LammpsMinimization.force_field</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.LammpsMinimization.read_data"><code class="docutils literal notranslate"><span class="pre">LammpsMinimization.read_data</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.generators.LammpsMinimization.units"><code class="docutils literal notranslate"><span class="pre">LammpsMinimization.units</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#module-pymatgen.io.lammps.inputs">pymatgen.io.lammps.inputs module</a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.add_commands"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.add_commands()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.add_stage"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.add_stage()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.append"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.append()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.contains_command"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.contains_command()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.from_file"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.from_file()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.from_str"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.from_str()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.get_args"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.get_args()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.get_str"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.get_str()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.merge_stages"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.merge_stages()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.ncomments"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.ncomments</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.nstages"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.nstages</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.remove_command"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.remove_command()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.remove_stage"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.remove_stage()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.rename_stage"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.rename_stage()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.set_args"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.set_args()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.stages_names"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.stages_names</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile.write_file"><code class="docutils literal notranslate"><span class="pre">LammpsInputFile.write_file()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsRun"><code class="docutils literal notranslate"><span class="pre">LammpsRun</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsRun.md"><code class="docutils literal notranslate"><span class="pre">LammpsRun.md()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsRun.write_inputs"><code class="docutils literal notranslate"><span class="pre">LammpsRun.write_inputs()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsTemplateGen"><code class="docutils literal notranslate"><span class="pre">LammpsTemplateGen</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsTemplateGen.get_input_set"><code class="docutils literal notranslate"><span class="pre">LammpsTemplateGen.get_input_set()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.inputs.write_lammps_inputs"><code class="docutils literal notranslate"><span class="pre">write_lammps_inputs()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-pymatgen.io.lammps.outputs">pymatgen.io.lammps.outputs module</a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.outputs.LammpsDump"><code class="docutils literal notranslate"><span class="pre">LammpsDump</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.outputs.LammpsDump.as_dict"><code class="docutils literal notranslate"><span class="pre">LammpsDump.as_dict()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.outputs.LammpsDump.from_dict"><code class="docutils literal notranslate"><span class="pre">LammpsDump.from_dict()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.outputs.LammpsDump.from_str"><code class="docutils literal notranslate"><span class="pre">LammpsDump.from_str()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.outputs.parse_lammps_dumps"><code class="docutils literal notranslate"><span class="pre">parse_lammps_dumps()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.outputs.parse_lammps_log"><code class="docutils literal notranslate"><span class="pre">parse_lammps_log()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#module-pymatgen.io.lammps.sets">pymatgen.io.lammps.sets module</a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.sets.LammpsInputSet"><code class="docutils literal notranslate"><span class="pre">LammpsInputSet</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.sets.LammpsInputSet.from_directory"><code class="docutils literal notranslate"><span class="pre">LammpsInputSet.from_directory()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.sets.LammpsInputSet.validate"><code class="docutils literal notranslate"><span class="pre">LammpsInputSet.validate()</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#module-pymatgen.io.lammps.utils">pymatgen.io.lammps.utils module</a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.utils.LammpsRunner"><code class="docutils literal notranslate"><span class="pre">LammpsRunner</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.utils.LammpsRunner.run"><code class="docutils literal notranslate"><span class="pre">LammpsRunner.run()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.utils.PackmolRunner"><code class="docutils literal notranslate"><span class="pre">PackmolRunner</span></code></a><ul>
<li><a class="reference internal" href="#pymatgen.io.lammps.utils.PackmolRunner.convert_obatoms_to_molecule"><code class="docutils literal notranslate"><span class="pre">PackmolRunner.convert_obatoms_to_molecule()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.utils.PackmolRunner.restore_site_properties"><code class="docutils literal notranslate"><span class="pre">PackmolRunner.restore_site_properties()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.utils.PackmolRunner.run"><code class="docutils literal notranslate"><span class="pre">PackmolRunner.run()</span></code></a></li>
<li><a class="reference internal" href="#pymatgen.io.lammps.utils.PackmolRunner.write_pdb"><code class="docutils literal notranslate"><span class="pre">PackmolRunner.write_pdb()</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#pymatgen.io.lammps.utils.Polymer"><code class="docutils literal notranslate"><span class="pre">Polymer</span></code></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu"  style="background: linear-gradient(0deg, rgba(23,63,162,1) 0%, rgba(0,70,192,1) 100%)" >
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">pymatgen</a>
      </nav>

      <div class="wy-nav-content">
        <div class="rst-content style-external-links">
          <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="index.html" class="icon icon-home" aria-label="Home"></a></li>
      <li class="breadcrumb-item active">pymatgen.io.lammps package</li>
      <li class="wy-breadcrumbs-aside">
              <a href="https://github.com/materialsproject/pymatgen/blob/master/docs_rst/pymatgen.io.lammps.rst" class="fa fa-github"> Edit on GitHub</a>
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
             
  <section id="module-pymatgen.io.lammps">
<span id="pymatgen-io-lammps-package"></span><h1>pymatgen.io.lammps package<a class="headerlink" href="#module-pymatgen.io.lammps" title="Link to this heading"></a></h1>
<p>IO for LAMMPS.</p>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Link to this heading"></a></h2>
</section>
<section id="module-pymatgen.io.lammps.data">
<span id="pymatgen-io-lammps-data-module"></span><h2>pymatgen.io.lammps.data module<a class="headerlink" href="#module-pymatgen.io.lammps.data" title="Link to this heading"></a></h2>
<p>This module implements a core class LammpsData for generating/parsing
LAMMPS data file, and other bridging classes to build LammpsData from
molecules. This module also implements a subclass CombinedData for
merging LammpsData object.</p>
<p>Only point particle styles are supported for now (atom_style in angle,
atomic, bond, charge, full and molecular only). See the pages below for
more info.</p>
<blockquote>
<div><p><a class="reference external" href="https://docs.lammps.org/atom_style.html">https://docs.lammps.org/atom_style.html</a>
<a class="reference external" href="https://docs.lammps.org/read_data.html">https://docs.lammps.org/read_data.html</a></p>
</div></blockquote>
<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">CombinedData</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">list_of_molecules</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">list_of_names</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">list_of_numbers</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coordinates</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">DataFrame</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">atom_style</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'full'</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1269-L1576"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><code class="xref py py-class docutils literal notranslate"><span class="pre">LammpsData</span></code></a></p>
<p>Object for a collective set of data for a series of LAMMPS data file.
velocities not yet implemented.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>list_of_molecules</strong> – A list of LammpsData objects of a chemical cluster.
Each LammpsData object (cluster) may contain one or more molecule ID.</p></li>
<li><p><strong>list_of_names</strong> – A list of name (string) for each cluster. The characters in each name are
restricted to word characters ([<a href="#id20"><span class="problematic" id="id21">a-zA-Z0-9_</span></a>]). If names with any non-word characters
are passed in, the special characters will be substituted by ‘_’.</p></li>
<li><p><strong>list_of_numbers</strong> – A list of Integer for counts of each molecule</p></li>
<li><p><strong>coordinates</strong> (<em>pandas.DataFrame</em>) – DataFrame at least containing
columns of [“x”, “y”, “z”] for coordinates of atoms.</p></li>
<li><p><strong>atom_style</strong> (<em>str</em>) – Output atom_style. Default to “full”.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData.as_lammpsdata">
<span class="sig-name descname"><span class="pre">as_lammpsdata</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1551-L1576"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData.as_lammpsdata" title="Link to this definition"></a></dt>
<dd><p>Convert a CombinedData object to a LammpsData object. attributes are deep-copied.</p>
<p>box (LammpsBox): Simulation box.
force_fieldct (dict): Data for force field sections. Optional</p>
<blockquote>
<div><p>with default to None. Only keywords in force field and
class 2 force field are valid keys, and each value is a
DataFrame.</p>
</div></blockquote>
<dl class="simple">
<dt>topology (dict): Data for topology sections. Optional with</dt><dd><p>default to None. Only keywords in topology are valid
keys, and each value is a DataFrame.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData.disassemble">
<span class="sig-name descname"><span class="pre">disassemble</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">atom_labels</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">guess_element</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ff_label</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'ff_map'</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1383-L1421"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData.disassemble" title="Link to this definition"></a></dt>
<dd><p>Breaks down each LammpsData in CombinedData to building blocks
(LammpsBox, ForceField and a series of Topology).
RESTRICTIONS APPLIED:
1. No complex force field defined not just on atom</p>
<blockquote>
<div><p>types, where the same type or equivalent types of topology
may have more than one set of coefficients.</p>
</div></blockquote>
<ol class="arabic simple" start="2">
<li><dl class="simple">
<dt>No intermolecular topologies (with atoms from different</dt><dd><p>molecule-ID) since a Topology object includes data for ONE
molecule or structure only.</p>
</dd>
</dl>
</li>
</ol>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>atom_labels</strong> (<em>[</em><em>str</em><em>]</em>) – List of strings (must be different
from one another) for labelling each atom type found in
Masses section. Default to None, where the labels are
automatically added based on either element guess or
dummy specie assignment.</p></li>
<li><p><strong>guess_element</strong> (<em>bool</em>) – Whether to guess the element based on
its atomic mass. Default to True, otherwise dummy
species “Qa”, “Qb”, … will be assigned to various
atom types. The guessed or assigned elements will be
reflected on atom labels if atom_labels is None, as
well as on the species of molecule in each Topology.</p></li>
<li><p><strong>ff_label</strong> (<em>str</em>) – Site property key for labeling atoms of
different types. Default to “ff_map”.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>[(LammpsBox, ForceField, [Topology]), …]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData.from_ff_and_topologies">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_ff_and_topologies</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1424-L1427"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData.from_ff_and_topologies" title="Link to this definition"></a></dt>
<dd><p>Unsupported constructor for CombinedData objects.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData.from_files">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_files</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">coordinate_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">list_of_numbers</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="o"><span class="pre">*</span></span><span class="n"><span class="pre">filenames</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1456-L1483"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData.from_files" title="Link to this definition"></a></dt>
<dd><p>Constructor that parse a series of data file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>coordinate_file</strong> (<em>str</em>) – The filename of xyz coordinates.</p></li>
<li><p><strong>list_of_numbers</strong> (<em>list</em><em>[</em><em>int</em><em>]</em>) – A list of numbers specifying counts for each
clusters parsed from files.</p></li>
<li><p><strong>filenames</strong> (<em>str</em>) – A series of LAMMPS data filenames in string format.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData.from_lammpsdata">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_lammpsdata</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mols</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">names</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">list_of_numbers</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">coordinates</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">pd.DataFrame</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">atom_style</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1485-L1516"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData.from_lammpsdata" title="Link to this definition"></a></dt>
<dd><p>Constructor that can infer atom_style.
The input LammpsData objects are used non-destructively.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mols</strong> – a list of LammpsData of a chemical cluster.Each LammpsData object (cluster)
may contain one or more molecule ID.</p></li>
<li><p><strong>names</strong> – a list of name for each cluster.</p></li>
<li><p><strong>list_of_numbers</strong> – a list of Integer for counts of each molecule</p></li>
<li><p><strong>coordinates</strong> (<em>pandas.DataFrame</em>) – DataFrame at least containing
columns of [“x”, “y”, “z”] for coordinates of atoms.</p></li>
<li><p><strong>atom_style</strong> (<em>str</em>) – Output atom_style. Default to “full”.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData.from_structure">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_structure</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1429-L1432"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData.from_structure" title="Link to this definition"></a></dt>
<dd><p>Unsupported constructor for CombinedData objects.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData.get_str">
<span class="sig-name descname"><span class="pre">get_str</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">distance</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">6</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">velocity</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">8</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">charge</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">hybrid</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1518-L1549"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData.get_str" title="Link to this definition"></a></dt>
<dd><p>Get the string representation of CombinedData, essentially
the string to be written to a file. Combination info is included
as a comment. For single molecule ID data, the info format is:</p>
<blockquote>
<div><p>num name</p>
</div></blockquote>
<dl class="simple">
<dt>For data with multiple molecule ID, the format is:</dt><dd><p>num(mols_per_data) name.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>distance</strong> (<em>int</em>) – No. of significant figures to output for
box settings (bounds and tilt) and atomic coordinates.
Default to 6.</p></li>
<li><p><strong>velocity</strong> (<em>int</em>) – No. of significant figures to output for
velocities. Default to 8.</p></li>
<li><p><strong>charge</strong> (<em>int</em>) – No. of significant figures to output for
charges. Default to 4.</p></li>
<li><p><strong>hybrid</strong> (<em>bool</em>) – Whether to write hybrid coeffs types.
Default to True. If the data object has no hybrid
coeffs types and has large coeffs section, one may
use False to speed up the process. Otherwise, the
default is recommended.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>String representation of CombinedData.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData.parse_xyz">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">parse_xyz</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">Path</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">DataFrame</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1434-L1454"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData.parse_xyz" title="Link to this definition"></a></dt>
<dd><p>Load xyz file generated from packmol (for those who find it hard to install openbabel).</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>pandas.DataFrame</p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.CombinedData.structure">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">structure</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Structure" title="pymatgen.core.structure.Structure"><span class="pre">Structure</span></a></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/data.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.CombinedData.structure" title="Link to this definition"></a></dt>
<dd><p>Exports a periodic structure object representing the simulation
box.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Structure</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.ForceField">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ForceField</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mass_info</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nonbond_coeffs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">topo_coeffs</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1063-L1266"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.ForceField" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">MSONable</span></code></p>
<p>Class carrying most data in masses and force field sections.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.ForceField.masses">
<span class="sig-name descname"><span class="pre">masses</span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/data.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.ForceField.masses" title="Link to this definition"></a></dt>
<dd><p>DataFrame for masses section.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p>pandas.DataFrame</p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.ForceField.force_fieldct">
<span class="sig-name descname"><span class="pre">force_fieldct</span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/data.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.ForceField.force_fieldct" title="Link to this definition"></a></dt>
<dd><p>Force field section keywords (keys) and
data (values) as DataFrames.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p>dict</p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.ForceField.maps">
<span class="sig-name descname"><span class="pre">maps</span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/data.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.ForceField.maps" title="Link to this definition"></a></dt>
<dd><p>Dict for labeling atoms and topologies.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p>dict</p>
</dd>
</dl>
</dd></dl>

<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mass_info</strong> (<em>list</em>) – List of atomic mass info. Elements,
strings (symbols) and floats are all acceptable for the
values, with the first two converted to the atomic mass
of an element. It is recommended to use
dict.items() to prevent key duplications.
[(“C”, 12.01), (“H”, Element(“H”)), (“O”, “O”), …]</p></li>
<li><p><strong>nonbond_coeffs</strong> (<em>list</em>) – List of Pair or PairIJ
coefficients, of which the sequence must be sorted
according to the species in mass_dict. Pair or PairIJ
determined by the length of list. Optional with default
to None.</p></li>
<li><p><strong>topo_coeffs</strong> (<em>dict</em>) – <p>Dict with force field coefficients for
molecular topologies. Optional with default
to None. All four valid keys listed below are optional.
Each value is a list of dicts with non-optional keys
“coeffs” and “types”, and related class2 force field
keywords as optional keys.
{</p>
<blockquote>
<div><dl class="simple">
<dt>”Bond Coeffs”:</dt><dd><dl class="simple">
<dt>[{“coeffs”: [coeff],</dt><dd><p>”types”: [(“C”, “C”), …]}, …],</p>
</dd>
</dl>
</dd>
<dt>”Angle Coeffs”:</dt><dd><dl class="simple">
<dt>[{“coeffs”: [coeff],</dt><dd><p>”BondBond Coeffs”: [coeff],
“types”: [(“H”, “C”, “H”), …]}, …],</p>
</dd>
</dl>
</dd>
<dt>”Dihedral Coeffs”:</dt><dd><dl class="simple">
<dt>[{“coeffs”: [coeff],</dt><dd><p>”BondBond13 Coeffs”: [coeff],
“types”: [(“H”, “C”, “C”, “H”), …]}, …],</p>
</dd>
</dl>
</dd>
<dt>”Improper Coeffs”:</dt><dd><dl class="simple">
<dt>[{“coeffs”: [coeff],</dt><dd><p>”AngleAngle Coeffs”: [coeff],
“types”: [(“H”, “C”, “C”, “H”), …]}, …],</p>
</dd>
</dl>
</dd>
</dl>
</div></blockquote>
<p>}
Topology of same type or equivalent types (e.g.,
(“C”, “H”) and (“H”, “C”) bonds) are NOT ALLOWED to
be defined MORE THAN ONCE with DIFFERENT coefficients.</p>
</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.ForceField.from_dict">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_dict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dct</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1253-L1266"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.ForceField.from_dict" title="Link to this definition"></a></dt>
<dd><p>Constructor that reads in a dictionary.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>dct</strong> (<em>dict</em>) – Dictionary to read.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.ForceField.from_file">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1241-L1251"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.ForceField.from_file" title="Link to this definition"></a></dt>
<dd><p>Constructor that reads in a file in YAML format.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>filename</strong> (<em>str</em>) – Filename.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.ForceField.to_file">
<span class="sig-name descname"><span class="pre">to_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L1226-L1239"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.ForceField.to_file" title="Link to this definition"></a></dt>
<dd><p>Save force field to a file in YAML format.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>filename</strong> (<em>str</em>) – Filename.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsBox">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">LammpsBox</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">bounds</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tilt</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L115-L195"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsBox" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">MSONable</span></code></p>
<p>Object for representing a simulation box in LAMMPS settings.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>bounds</strong> – A (3, 2) array/list of floats setting the
boundaries of simulation box.</p></li>
<li><p><strong>tilt</strong> – A (3,) array/list of floats setting the tilt of
simulation box. Default to None, i.e., use an
orthogonal box.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsBox.get_box_shift">
<span class="sig-name descname"><span class="pre">get_box_shift</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">i</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">np.ndarray</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L174-L185"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsBox.get_box_shift" title="Link to this definition"></a></dt>
<dd><p>Calculates the coordinate shift due to PBC.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>i</strong> – A (n, 3) integer array containing the labels for box</p></li>
<li><p><strong>entries.</strong> (<em>images</em><em> of </em><em>n</em>)</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>Coordinate shift array with the same shape of i</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsBox.get_str">
<span class="sig-name descname"><span class="pre">get_str</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">significant_figures</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">6</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L156-L172"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsBox.get_str" title="Link to this definition"></a></dt>
<dd><p>Get the string representation of simulation box in LAMMPS data file format.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>significant_figures</strong> (<em>int</em>) – No. of significant figures to
output for box settings. Default to 6.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsBox.to_lattice">
<span class="sig-name descname"><span class="pre">to_lattice</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.lattice.Lattice" title="pymatgen.core.lattice.Lattice"><span class="pre">Lattice</span></a></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L187-L195"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsBox.to_lattice" title="Link to this definition"></a></dt>
<dd><p>Convert the simulation box to a more powerful Lattice backend.
Note that Lattice is always periodic in 3D space while a
simulation box is not necessarily periodic in all dimensions.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Lattice</p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsBox.volume">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">volume</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">float</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/data.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsBox.volume" title="Link to this definition"></a></dt>
<dd><p>Volume of simulation box.</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">LammpsData</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">box</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox" title="pymatgen.io.lammps.data.LammpsBox"><span class="pre">LammpsBox</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">masses</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">DataFrame</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">atoms</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">DataFrame</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">velocities</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">DataFrame</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">force_field</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">topology</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">DataFrame</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">atom_style</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'full'</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L227-L921"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">MSONable</span></code></p>
<p>Object for representing the data in a LAMMPS data file.</p>
<p>Low level constructor designed to work with parsed data or other bridging
objects (ForceField and Topology). Not recommended to use directly.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>box</strong> (<a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox" title="pymatgen.io.lammps.data.LammpsBox"><em>LammpsBox</em></a>) – Simulation box.</p></li>
<li><p><strong>masses</strong> (<em>pandas.DataFrame</em>) – DataFrame with one column
[“mass”] for Masses section.</p></li>
<li><p><strong>atoms</strong> (<em>pandas.DataFrame</em>) – DataFrame with multiple columns
for Atoms section. Column names vary with atom_style.</p></li>
<li><p><strong>velocities</strong> (<em>pandas.DataFrame</em>) – DataFrame with three columns
[“vx”, “vy”, “vz”] for Velocities section. Optional
with default to None. If not None, its index should be
consistent with atoms.</p></li>
<li><p><strong>force_fieldct</strong> (<em>dict</em>) – Data for force field sections. Optional
with default to None. Only keywords in force field and
class 2 force field are valid keys, and each value is a
DataFrame.</p></li>
<li><p><strong>topology</strong> (<em>dict</em>) – Data for topology sections. Optional with
default to None. Only keywords in topology are valid
keys, and each value is a DataFrame.</p></li>
<li><p><strong>atom_style</strong> (<em>str</em>) – Output atom_style. Default to “full”.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData.disassemble">
<span class="sig-name descname"><span class="pre">disassemble</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">atom_labels</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">guess_element</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ff_label</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'ff_map'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox" title="pymatgen.io.lammps.data.LammpsBox"><span class="pre">LammpsBox</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="#pymatgen.io.lammps.data.ForceField" title="pymatgen.io.lammps.data.ForceField"><span class="pre">ForceField</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pymatgen.io.lammps.data.Topology" title="pymatgen.io.lammps.data.Topology"><span class="pre">Topology</span></a><span class="p"><span class="pre">]</span></span><span class="p"><span class="pre">]</span></span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L479-L637"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData.disassemble" title="Link to this definition"></a></dt>
<dd><p>Breaks down LammpsData to building blocks
(LammpsBox, ForceField and a series of Topology).
RESTRICTIONS APPLIED:</p>
<ol class="arabic simple">
<li><dl class="simple">
<dt>No complex force field defined not just on atom</dt><dd><p>types, where the same type or equivalent types of topology
may have more than one set of coefficients.</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>No intermolecular topologies (with atoms from different</dt><dd><p>molecule-ID) since a Topology object includes data for ONE
molecule or structure only.</p>
</dd>
</dl>
</li>
</ol>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>atom_labels</strong> (<em>[</em><em>str</em><em>]</em>) – List of strings (must be different
from one another) for labelling each atom type found in
Masses section. Default to None, where the labels are
automatically added based on either element guess or
dummy specie assignment.</p></li>
<li><p><strong>guess_element</strong> (<em>bool</em>) – Whether to guess the element based on
its atomic mass. Default to True, otherwise dummy
species “Qa”, “Qb”, … will be assigned to various
atom types. The guessed or assigned elements will be
reflected on atom labels if atom_labels is None, as
well as on the species of molecule in each Topology.</p></li>
<li><p><strong>ff_label</strong> (<em>str</em>) – Site property key for labeling atoms of
different types. Default to “ff_map”.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>LammpsBox, ForceField, [Topology]</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData.from_ff_and_topologies">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_ff_and_topologies</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">box</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox" title="pymatgen.io.lammps.data.LammpsBox"><span class="pre">LammpsBox</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">ff</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.data.ForceField" title="pymatgen.io.lammps.data.ForceField"><span class="pre">ForceField</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">topologies</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pymatgen.io.lammps.data.Topology" title="pymatgen.io.lammps.data.Topology"><span class="pre">Topology</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">atom_style</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'full'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L756-L847"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData.from_ff_and_topologies" title="Link to this definition"></a></dt>
<dd><p>Constructor building LammpsData from a ForceField object and a
list of Topology objects. Do not support intermolecular
topologies since a Topology object includes data for ONE
molecule or structure only.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>box</strong> (<a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox" title="pymatgen.io.lammps.data.LammpsBox"><em>LammpsBox</em></a>) – Simulation box.</p></li>
<li><p><strong>ff</strong> (<a class="reference internal" href="#pymatgen.io.lammps.data.ForceField" title="pymatgen.io.lammps.data.ForceField"><em>ForceField</em></a>) – ForceField object with data for Masses and
force field sections.</p></li>
<li><p><strong>topologies</strong> (<em>[</em><a class="reference internal" href="#pymatgen.io.lammps.data.Topology" title="pymatgen.io.lammps.data.Topology"><em>Topology</em></a><em>]</em>) – List of Topology objects with data
for Atoms, Velocities and topology sections.</p></li>
<li><p><strong>atom_style</strong> (<em>str</em>) – Output atom_style. Default to “full”.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData.from_file">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">atom_style</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'full'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">sort_id</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L639-L754"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData.from_file" title="Link to this definition"></a></dt>
<dd><p>Constructor that parses a file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>filename</strong> (<em>str</em>) – Filename to read.</p></li>
<li><p><strong>atom_style</strong> (<em>str</em>) – Associated atom_style. Default to “full”.</p></li>
<li><p><strong>sort_id</strong> (<em>bool</em>) – Whether sort each section by id. Default to
True.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData.from_structure">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_structure</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">structure</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Structure" title="pymatgen.core.structure.Structure"><span class="pre">Structure</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.IStructure" title="pymatgen.core.structure.IStructure"><span class="pre">IStructure</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">ff_elements</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">atom_style</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Literal</span><span class="p"><span class="pre">[</span></span><span class="s"><span class="pre">'atomic'</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="s"><span class="pre">'charge'</span></span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'charge'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">is_sort</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L849-L893"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData.from_structure" title="Link to this definition"></a></dt>
<dd><p>Simple constructor building LammpsData from a structure without
force field parameters and topologies.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>structure</strong> (<a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Structure" title="pymatgen.core.structure.Structure"><em>Structure</em></a>) – Input structure.</p></li>
<li><p><strong>ff_elements</strong> (<em>[</em><em>str</em><em>]</em>) – List of strings of elements that must
be present due to force field settings but not
necessarily in the structure. Default to None.</p></li>
<li><p><strong>atom_style</strong> (<em>str</em>) – Choose between “atomic” (neutral) and
“charge” (charged). Default to “charge”.</p></li>
<li><p><strong>is_sort</strong> (<em>bool</em>) – whether to sort sites</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData.get_str">
<span class="sig-name descname"><span class="pre">get_str</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">distance</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">6</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">velocity</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">8</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">charge</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">4</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">hybrid</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L318-L461"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData.get_str" title="Link to this definition"></a></dt>
<dd><p>Get the string representation of LammpsData, essentially the string
to be written to a file. Supports hybrid style coeffs read and write.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>distance</strong> (<em>int</em>) – No. of significant figures to output for
box settings (bounds and tilt) and atomic coordinates.
Default to 6.</p></li>
<li><p><strong>velocity</strong> (<em>int</em>) – No. of significant figures to output for
velocities. Default to 8.</p></li>
<li><p><strong>charge</strong> (<em>int</em>) – No. of significant figures to output for
charges. Default to 4.</p></li>
<li><p><strong>hybrid</strong> (<em>bool</em>) – Whether to write hybrid coeffs types.
Default to True. If the data object has no hybrid
coeffs types and has large coeffs section, one may
use False to speed up the process. Otherwise, the
default is recommended.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>String representation of LammpsData.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData.set_charge_atom">
<span class="sig-name descname"><span class="pre">set_charge_atom</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">charges</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">float</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L895-L904"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData.set_charge_atom" title="Link to this definition"></a></dt>
<dd><p>Set the charges of specific atoms of the data.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>charges</strong> – A dictionary with atom indexes as keys and
charges as values, e.g. to set the charge
of the atom with index 3 to -2, use <cite>{3: -2}</cite>.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData.set_charge_atom_type">
<span class="sig-name descname"><span class="pre">set_charge_atom_type</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">charges</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">float</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L906-L921"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData.set_charge_atom_type" title="Link to this definition"></a></dt>
<dd><p>Add or modify charges of all atoms of a given type in the data.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>charges</strong> – <p>Dict containing the charges for the atom types to set.
The dict should contain atom types as integers or labels and charges.
Example: change the charge of Li atoms to +3:</p>
<blockquote>
<div><p>charges={“Li”: 3}
charges={1: 3} if Li atoms are of type 1</p>
</div></blockquote>
</p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData.structure">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">structure</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Structure" title="pymatgen.core.structure.Structure"><span class="pre">Structure</span></a></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/data.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData.structure" title="Link to this definition"></a></dt>
<dd><p>Exports a periodic structure object representing the simulation
box.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns<span class="colon">:</span></dt>
<dd class="field-odd"><p>Structure</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.LammpsData.write_file">
<span class="sig-name descname"><span class="pre">write_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">distance</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">6</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">velocity</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">8</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">charge</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">4</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L463-L477"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.LammpsData.write_file" title="Link to this definition"></a></dt>
<dd><p>Write LammpsData to file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>filename</strong> (<em>str</em>) – Filename.</p></li>
<li><p><strong>distance</strong> (<em>int</em>) – No. of significant figures to output for
box settings (bounds and tilt) and atomic coordinates.
Default to 6.</p></li>
<li><p><strong>velocity</strong> (<em>int</em>) – No. of significant figures to output for
velocities. Default to 8.</p></li>
<li><p><strong>charge</strong> (<em>int</em>) – No. of significant figures to output for
charges. Default to 4.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.Topology">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Topology</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">sites</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="pymatgen.core.html#pymatgen.core.sites.Site" title="pymatgen.core.sites.Site"><span class="pre">Site</span></a><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.SiteCollection" title="pymatgen.core.structure.SiteCollection"><span class="pre">SiteCollection</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">ff_label</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">charges</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">velocities</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span><span class="p"><span class="pre">[</span></span><span class="pre">Sequence</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">topologies</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L924-L1060"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.Topology" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">MSONable</span></code></p>
<p>Carry most data in Atoms, Velocities and Molecular Topology sections for
ONE SINGLE Molecule or Structure object, or a plain list of Sites.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>sites</strong> (<em>[</em><a class="reference internal" href="pymatgen.core.html#pymatgen.core.sites.Site" title="pymatgen.core.sites.Site"><em>Site</em></a><em>] or </em><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.SiteCollection" title="pymatgen.core.structure.SiteCollection"><em>SiteCollection</em></a>) – A group of sites in a
list or as a Molecule/Structure.</p></li>
<li><p><strong>ff_label</strong> (<em>str</em>) – Site property key for labeling atoms of
different types. Default to None, i.e., use
site.species_string.</p></li>
<li><p><strong>charges</strong> (<em>[</em><em>q</em><em>, </em><em>...</em><em>]</em>) – Charge of each site in a (n,)
array/list, where n is the No. of sites. Default to
None, i.e., search site property for charges.</p></li>
<li><p><strong>velocities</strong> (<em>[</em><em>[</em><em>vx</em><em>, </em><em>vy</em><em>, </em><em>vz</em><em>]</em><em>, </em><em>...</em><em>]</em>) – Velocity of each site in
a (n, 3) array/list, where n is the No. of sites.
Default to None, i.e., search site property for
velocities.</p></li>
<li><p><strong>topologies</strong> (<em>dict</em>) – <p>Bonds, angles, dihedrals and improper
dihedrals defined by site indices. Default to None,
i.e., no additional topology. All four valid keys
listed below are optional.
{</p>
<blockquote>
<div><p>”Bonds”: [[i, j], …],
“Angles”: [[i, j, k], …],
“Dihedrals”: [[i, j, k, l], …],
“Impropers”: [[i, j, k, l], …]</p>
</div></blockquote>
<p>}.</p>
</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.Topology.from_bonding">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_bonding</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">molecule</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><span class="pre">Molecule</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">bond</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">angle</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dihedral</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tol</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">0.1</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L994-L1060"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.Topology.from_bonding" title="Link to this definition"></a></dt>
<dd><p>Another constructor that creates an instance from a molecule.
Covalent bonds and other bond-based topologies (angles and
dihedrals) can be automatically determined. Cannot be used for
non bond-based topologies, e.g. improper dihedrals.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>molecule</strong> (<a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><em>Molecule</em></a>) – Input molecule.</p></li>
<li><p><strong>bond</strong> (<em>bool</em>) – Whether find bonds. If set to False, angle and
dihedral searching will be skipped. Default to True.</p></li>
<li><p><strong>angle</strong> (<em>bool</em>) – Whether find angles. Default to True.</p></li>
<li><p><strong>dihedral</strong> (<em>bool</em>) – Whether find dihedrals. Default to True.</p></li>
<li><p><strong>tol</strong> (<em>float</em>) – Bond distance tolerance. Default to 0.1.
Not recommended to alter.</p></li>
<li><p><strong>**kwargs</strong> – Other kwargs supported by Topology.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pymatgen.io.lammps.data.lattice_2_lmpbox">
<span class="sig-name descname"><span class="pre">lattice_2_lmpbox</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lattice</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.lattice.Lattice" title="pymatgen.core.lattice.Lattice"><span class="pre">Lattice</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">origin</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">(0,</span> <span class="pre">0,</span> <span class="pre">0)</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox" title="pymatgen.io.lammps.data.LammpsBox"><span class="pre">LammpsBox</span></a><span class="p"><span class="pre">,</span></span><span class="w"> </span><a class="reference internal" href="pymatgen.core.html#pymatgen.core.operations.SymmOp" title="pymatgen.core.operations.SymmOp"><span class="pre">SymmOp</span></a><span class="p"><span class="pre">]</span></span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/data.py#L198-L224"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.data.lattice_2_lmpbox" title="Link to this definition"></a></dt>
<dd><p>Converts a lattice object to LammpsBox, and calculates the symmetry
operation used.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>lattice</strong> (<a class="reference internal" href="pymatgen.core.html#pymatgen.core.lattice.Lattice" title="pymatgen.core.lattice.Lattice"><em>Lattice</em></a>) – Input lattice.</p></li>
<li><p><strong>origin</strong> – A (3,) array/list of floats setting lower bounds of
simulation box. Default to (0, 0, 0).</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>tuple[LammpsBox, SymmOp]</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="module-pymatgen.io.lammps.generators">
<span id="pymatgen-io-lammps-generators-module"></span><h2>pymatgen.io.lammps.generators module<a class="headerlink" href="#module-pymatgen.io.lammps.generators" title="Link to this heading"></a></h2>
<p>Input set generators for LAMMPS.
This InputSet and InputGenerator implementation is based on templates and is not intended to be very flexible.
For instance, pymatgen will not detect whether a given variable should be adapted based on others
(e.g., the number of steps from the temperature), it will not check for convergence nor will it actually run LAMMPS.
For additional flexibility and automation, use the atomate2-lammps implementation
(<a class="reference external" href="https://github.com/Matgenix/atomate2-lammps">https://github.com/Matgenix/atomate2-lammps</a>).</p>
<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.BaseLammpsGenerator">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">BaseLammpsGenerator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputfile:</span> <span class="pre">~pymatgen.io.lammps.inputs.LammpsInputFile</span> <span class="pre">|</span> <span class="pre">None</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">template:</span> <span class="pre">str</span> <span class="pre">=</span> <span class="pre">&lt;factory&gt;</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data:</span> <span class="pre">~pymatgen.io.lammps.data.LammpsData</span> <span class="pre">|</span> <span class="pre">~pymatgen.io.lammps.data.CombinedData</span> <span class="pre">|</span> <span class="pre">None</span> <span class="pre">=</span> <span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">settings:</span> <span class="pre">dict</span> <span class="pre">=</span> <span class="pre">&lt;factory&gt;</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">calc_type:</span> <span class="pre">str</span> <span class="pre">=</span> <span class="pre">'lammps'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">keep_stages:</span> <span class="pre">bool</span> <span class="pre">=</span> <span class="pre">True</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/generators.py#L32-L84"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="pymatgen.io.html#pymatgen.io.core.InputGenerator" title="pymatgen.io.core.InputGenerator"><code class="xref py py-class docutils literal notranslate"><span class="pre">InputGenerator</span></code></a></p>
<p>Base class to generate LAMMPS input sets.
Uses template files for the input. The variables that can be changed
in the input template file are those starting with a $ sign, e.g. $nsteps.
This generic class is specialized for each template in subclasses, e.g. LammpsMinimization.
You can create a template for your own task following those present in pymatgen/io/lammps/templates.
The parameters are then replaced based on the values found
in the settings dictionary that you provide, e.g. <cite>{“nsteps”: 1000}</cite>.</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.BaseLammpsGenerator.template">
<span class="sig-name descname"><span class="pre">template</span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.template" title="Link to this definition"></a></dt>
<dd><p>Path (string) to the template file used to create the InputFile for LAMMPS.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.BaseLammpsGenerator.calc_type">
<span class="sig-name descname"><span class="pre">calc_type</span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.calc_type" title="Link to this definition"></a></dt>
<dd><p>Human-readable string used to briefly describe the type of computations performed by LAMMPS.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.BaseLammpsGenerator.settings">
<span class="sig-name descname"><span class="pre">settings</span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.settings" title="Link to this definition"></a></dt>
<dd><p>Dictionary containing the values of the parameters to replace in the template.</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p>dict</p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.BaseLammpsGenerator.keep_stages">
<span class="sig-name descname"><span class="pre">keep_stages</span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.keep_stages" title="Link to this definition"></a></dt>
<dd><p>If True, the string is formatted in a block structure with stage names</p>
<dl class="field-list simple">
<dt class="field-odd">Type<span class="colon">:</span></dt>
<dd class="field-odd"><p>bool</p>
</dd>
</dl>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">and</span> <span class="pre">newlines</span> <span class="pre">that</span> <span class="pre">differentiate</span> <span class="pre">commands</span> <span class="pre">in</span> <span class="pre">the</span> <span class="pre">respective</span> <span class="pre">stages</span> <span class="pre">of</span> <span class="pre">the</span> <span class="pre">InputFile.</span></span></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py">
<span class="sig-name descname"><span class="pre">If</span> <span class="pre">False,</span> <span class="pre">stage</span> <span class="pre">names</span> <span class="pre">are</span> <span class="pre">not</span> <span class="pre">printed</span> <span class="pre">and</span> <span class="pre">all</span> <span class="pre">commands</span> <span class="pre">appear</span> <span class="pre">in</span> <span class="pre">a</span> <span class="pre">single</span> <span class="pre">block.</span></span></dt>
<dd></dd></dl>

<p>/!This InputSet and InputGenerator implementation is based on templates and is not intended to be very flexible.
For instance, pymatgen will not detect whether a given variable should be adapted based on others
(e.g., the number of steps from the temperature), it will not check for convergence nor will it actually run LAMMPS.
For additional flexibility and automation, use the atomate2-lammps implementation
(<a class="reference external" href="https://github.com/Matgenix/atomate2-lammps">https://github.com/Matgenix/atomate2-lammps</a>).</p>
<dl class="py attribute">
<dt class="sig sig-object py" id="id0">
<span class="sig-name descname"><span class="pre">calc_type</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'lammps'</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#id0" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.BaseLammpsGenerator.data">
<span class="sig-name descname"><span class="pre">data</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><span class="pre">LammpsData</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData" title="pymatgen.io.lammps.data.CombinedData"><span class="pre">CombinedData</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.data" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.BaseLammpsGenerator.get_input_set">
<span class="sig-name descname"><span class="pre">get_input_set</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">structure</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Structure" title="pymatgen.core.structure.Structure"><span class="pre">Structure</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><span class="pre">LammpsData</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData" title="pymatgen.io.lammps.data.CombinedData"><span class="pre">CombinedData</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#pymatgen.io.lammps.sets.LammpsInputSet" title="pymatgen.io.lammps.sets.LammpsInputSet"><span class="pre">LammpsInputSet</span></a></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/generators.py#L65-L84"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.get_input_set" title="Link to this definition"></a></dt>
<dd><p>Generate a LammpsInputSet from the structure/data, tailored to the template file.</p>
</dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.BaseLammpsGenerator.inputfile">
<span class="sig-name descname"><span class="pre">inputfile</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile" title="pymatgen.io.lammps.inputs.LammpsInputFile"><span class="pre">LammpsInputFile</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">None</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator.inputfile" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="id1">
<span class="sig-name descname"><span class="pre">keep_stages</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">bool</span></em><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">True</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#id1" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="id2">
<span class="sig-name descname"><span class="pre">settings</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">dict</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#id2" title="Link to this definition"></a></dt>
<dd></dd></dl>

<dl class="py attribute">
<dt class="sig sig-object py" id="id3">
<span class="sig-name descname"><span class="pre">template</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#id3" title="Link to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.LammpsMinimization">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">LammpsMinimization</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">template</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">units</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'metal'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">atom_style</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'full'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dimension</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">3</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">boundary</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'p</span> <span class="pre">p</span> <span class="pre">p'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">read_data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'system.data'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">force_field</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'Unspecified</span> <span class="pre">force</span> <span class="pre">field!'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">keep_stages</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/generators.py#L87-L179"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.LammpsMinimization" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pymatgen.io.lammps.generators.BaseLammpsGenerator" title="pymatgen.io.lammps.generators.BaseLammpsGenerator"><code class="xref py py-class docutils literal notranslate"><span class="pre">BaseLammpsGenerator</span></code></a></p>
<p>Generator that yields a LammpsInputSet tailored for minimizing the energy of a system by iteratively
adjusting atom coordinates.
Example usage:
<code class="docutils literal notranslate"><span class="pre">`</span>
<span class="pre">structure</span> <span class="pre">=</span> <span class="pre">Structure.from_file(&quot;mp-149.cif&quot;)</span>
<span class="pre">lmp_minimization</span> <span class="pre">=</span> <span class="pre">LammpsMinimization(units=&quot;atomic&quot;).get_input_set(structure)</span>
<span class="pre">`</span></code>.</p>
<p>Do not forget to specify the force field, otherwise LAMMPS will not be able to run!</p>
<p>This InputSet and InputGenerator implementation is based on templates and is not intended to be very flexible.
For instance, pymatgen will not detect whether a given variable should be adapted based on others
(e.g., the number of steps from the temperature), it will not check for convergence nor will it actually run LAMMPS.
For additional flexibility and automation, use the atomate2-lammps implementation
(<a class="reference external" href="https://github.com/Matgenix/atomate2-lammps">https://github.com/Matgenix/atomate2-lammps</a>).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>template</strong> – Path (string) to the template file used to create the InputFile for LAMMPS.</p></li>
<li><p><strong>units</strong> – units to be used for the LAMMPS calculation (see LAMMPS docs).</p></li>
<li><p><strong>atom_style</strong> – atom_style to be used for the LAMMPS calculation (see LAMMPS docs).</p></li>
<li><p><strong>dimension</strong> – dimension to be used for the LAMMPS calculation (see LAMMPS docs).</p></li>
<li><p><strong>boundary</strong> – boundary to be used for the LAMMPS calculation (see LAMMPS docs).</p></li>
<li><p><strong>read_data</strong> – read_data to be used for the LAMMPS calculation (see LAMMPS docs).</p></li>
<li><p><strong>force_field</strong> – force field to be used for the LAMMPS calculation (see LAMMPS docs).
Note that you should provide all the required information as a single string.
In case of multiple lines expected in the input file,
separate them with ‘n’ in force_field.</p></li>
<li><p><strong>keep_stages</strong> – If True, the string is formatted in a block structure with stage names
and newlines that differentiate commands in the respective stages of the InputFile.
If False, stage names are not printed and all commands appear in a single block.</p></li>
</ul>
</dd>
</dl>
<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.LammpsMinimization.atom_style">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">atom_style</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.LammpsMinimization.atom_style" title="Link to this definition"></a></dt>
<dd><p>The argument of the command ‘atom_style’ passed to the generator.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.LammpsMinimization.boundary">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">boundary</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.LammpsMinimization.boundary" title="Link to this definition"></a></dt>
<dd><p>The argument of the command ‘boundary’ passed to the generator.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.LammpsMinimization.dimension">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">dimension</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.LammpsMinimization.dimension" title="Link to this definition"></a></dt>
<dd><p>The argument of the command ‘dimension’ passed to the generator.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.LammpsMinimization.force_field">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">force_field</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.LammpsMinimization.force_field" title="Link to this definition"></a></dt>
<dd><p>The details of the force field commands passed to the generator.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.LammpsMinimization.read_data">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">read_data</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.LammpsMinimization.read_data" title="Link to this definition"></a></dt>
<dd><p>The argument of the command ‘read_data’ passed to the generator.</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.generators.LammpsMinimization.units">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">units</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">str</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/generators.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.generators.LammpsMinimization.units" title="Link to this definition"></a></dt>
<dd><p>The argument of the command ‘units’ passed to the generator.</p>
</dd></dl>

</dd></dl>

</section>
<section id="module-pymatgen.io.lammps.inputs">
<span id="pymatgen-io-lammps-inputs-module"></span><h2>pymatgen.io.lammps.inputs module<a class="headerlink" href="#module-pymatgen.io.lammps.inputs" title="Link to this heading"></a></h2>
<p>This module implements methods for reading/manipulating/writing LAMMPS input files.
It does not implement methods for automatically creating inputs based on a structure
and computation type. For this, see the InputSet and InputGenerator in sets.py, or
<a class="reference external" href="https://github.com/Matgenix/atomate2-lammps">https://github.com/Matgenix/atomate2-lammps</a>.</p>
<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">LammpsInputFile</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stages</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L45-L873"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="pymatgen.io.html#pymatgen.io.core.InputFile" title="pymatgen.io.core.InputFile"><code class="xref py py-class docutils literal notranslate"><span class="pre">InputFile</span></code></a></p>
<p>LAMMPS input settings file such as <cite>in.lammps</cite>.
Allows for LAMMPS input generation in line/stage wise manner. A stage
here is defined as a block of LAMMPS input commands usually performing a
specific task during the simulation such as energy minimization or
NPT/NVT runs. But more broadly, a stage can also be a block of LAMMPS
input where the simulation box is set up, a set of variables are declared or
quantities are computed.</p>
<p>The LammpsInputFile is defined by the attribute <cite>stages</cite>,
i.e. a list of dicts each with keys <cite>stage_name</cite> and <cite>commands</cite>,
defining the stage names and the corresponding LAMMPS input settings (list of tuples of two strings each).
The structure is the following:
<a href="#id4"><span class="problematic" id="id5">``</span></a>`
stages = [</p>
<blockquote>
<div><p>{“stage_name”: “Stage 1”, “commands”: [(cmd1, args1), (cmd2, args2)]},
{“stage_name”: “Stage 2”, “commands”: [(cmd3, args3)]},</p>
</div></blockquote>
<section id="id6">
<h3>]<a class="headerlink" href="#id6" title="Link to this heading"></a></h3>
<p>where cmd’s are the LAMMPS command names (e.g., “units”, or “pair_coeff”)
and the args are the corresponding arguments.
“Stage 1” and “Stage 2” are examples of stage names.</p>
<dl class="field-list simple">
<dt class="field-odd">param stages<span class="colon">:</span></dt>
<dd class="field-odd"><p>list of LAMMPS input settings.</p>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.add_commands">
<span class="sig-name descname"><span class="pre">add_commands</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stage_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">commands</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">dict</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L364-L426"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.add_commands" title="Link to this definition"></a></dt>
<dd><p>Method to add a LAMMPS commands and their arguments to a stage of
the LammpsInputFile. The stage name should be provided: a default behavior
is avoided here to avoid mistakes (e.g., the commands are added to the wrong stage).</p>
<p class="rubric">Example</p>
<p>In order to add the command <code class="docutils literal notranslate"><span class="pre">pair_coeff</span> <span class="pre">1</span> <span class="pre">1</span> <span class="pre">morse</span> <span class="pre">0.0580</span> <span class="pre">3.987</span> <span class="pre">3.404</span></code>
to the stage “Definition of the potential”, simply use
<a href="#id7"><span class="problematic" id="id8">``</span></a>`
your_input_file.add_commands(</p>
<blockquote>
<div><p>stage_name=”Definition of the potential”, commands=”pair_coeff 1 1 morse 0.0580 3.987 3.404”</p>
</div></blockquote>
<section id="id9">
<h4>)<a class="headerlink" href="#id9" title="Link to this heading"></a></h4>
<p>To add multiple commands, use a dict or a list, e.g.
<a href="#id10"><span class="problematic" id="id11">``</span></a>`
your_input_file.add_commands(</p>
<blockquote>
<div><p>stage_name=”Definition of the potential”,
commands=[“pair_coeff 1 1 morse 0.0580 3.987 3.404”, “units atomic”],</p>
</div></blockquote>
<p>)
your_input_file.add_commands(</p>
<blockquote>
<div><p>stage_name=”Definition of the potential”,
commands={“pair_coeff”: “1 1 morse 0.0580 3.987 3.404”, “units”: “atomic”},</p>
</div></blockquote>
</section>
<section id="id12">
<h4>)<a class="headerlink" href="#id12" title="Link to this heading"></a></h4>
<dl class="field-list simple">
<dt class="field-odd">param stage_name<span class="colon">:</span></dt>
<dd class="field-odd"><p>name of the stage to which the command should be added.</p>
</dd>
<dt class="field-even">type stage_name<span class="colon">:</span></dt>
<dd class="field-even"><p>str</p>
</dd>
<dt class="field-odd">param commands<span class="colon">:</span></dt>
<dd class="field-odd"><p>LAMMPS command, with or without the arguments.</p>
</dd>
<dt class="field-even">type commands<span class="colon">:</span></dt>
<dd class="field-even"><p>str or list or dict</p>
</dd>
</dl>
</section>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.add_stage">
<span class="sig-name descname"><span class="pre">add_stage</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stage</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">commands</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">float</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stage_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">after_stage</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L196-L294"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.add_stage" title="Link to this definition"></a></dt>
<dd><p>Adds a new stage to the LammpsInputFile, either from a whole stage (dict) or
from a stage_name and commands. Both ways are mutually exclusive.</p>
<p class="rubric">Examples</p>
<p>1) In order to add a stage defining the force field to be used, you can use:
<a href="#id13"><span class="problematic" id="id14">``</span></a>`
your_input_file.add_stage(</p>
<blockquote>
<div><p>commands=[“pair_coeff 1 1 morse 0.0580 3.987 3.404”, “pair_coeff 1 4 morse 0.0408 1.399 3.204”],
stage_name=”Definition of the force field”,</p>
</div></blockquote>
<section id="id15">
<h4>)<a class="headerlink" href="#id15" title="Link to this heading"></a></h4>
</section>
<section id="or">
<h4>or<a class="headerlink" href="#or" title="Link to this heading"></a></h4>
<dl>
<dt>your_input_file.add_stage(</dt><dd><dl>
<dt>{</dt><dd><p>“stage_name”: “Definition of the force field”,
“commands”: [</p>
<blockquote>
<div><p>(“pair_coeff”, “1 1 morse 0.0580 3.987 3.404”),
(“pair_coeff”, “1 4 morse 0.0408 1.399 3.204”),</p>
</div></blockquote>
<p>],</p>
</dd>
</dl>
<p>}</p>
</dd>
</dl>
</section>
<section id="id16">
<h4>)<a class="headerlink" href="#id16" title="Link to this heading"></a></h4>
<p>2) Another stage could consist in an energy minimization. In that case, the commands could look like
<a href="#id17"><span class="problematic" id="id18">``</span></a>`
commands = [</p>
<blockquote>
<div><p>“thermo 1”,
“thermo_style custom step lx ly lz press pxx pyy pzz pe”,
“dump dmp all atom 5 run.dump”,
“min_style cg”,
“fix 1 all box/relax iso 0.0 vmax 0.001”,
“minimize 1.0e-16 1.0e-16 5000 10000”,
“write_data run.data”,</p>
</div></blockquote>
</section>
<section id="id19">
<h4>]<a class="headerlink" href="#id19" title="Link to this heading"></a></h4>
<p>or a dictionary such as <cite>{“thermo”: 1, …}</cite>, or a string with a single command (e.g., “units atomic”).</p>
<dl class="field-list simple">
<dt class="field-odd">param stage<span class="colon">:</span></dt>
<dd class="field-odd"><p>if provided, this is the stage that will be added to the LammpsInputFile.stages</p>
</dd>
<dt class="field-even">type stage<span class="colon">:</span></dt>
<dd class="field-even"><p>dict</p>
</dd>
<dt class="field-odd">param commands<span class="colon">:</span></dt>
<dd class="field-odd"><p>if provided, these are the LAMMPS command(s)
that will be included in the stage to add.
Can pass a list of LAMMPS commands with their arguments.
Also accepts a dictionary of LAMMPS commands and
corresponding arguments as key, value pairs.
A single string can also be passed (single command together with its arguments).
Not used in case a whole stage is given.</p>
</dd>
<dt class="field-even">type commands<span class="colon">:</span></dt>
<dd class="field-even"><p>str or list or dict</p>
</dd>
<dt class="field-odd">param stage_name<span class="colon">:</span></dt>
<dd class="field-odd"><p>If a stage name is mentioned, the commands are added
under that stage block, else the new stage is named from numbering.
If given, stage_name cannot be one of the already present stage names.
Not used in case a whole stage is given.</p>
</dd>
<dt class="field-even">type stage_name<span class="colon">:</span></dt>
<dd class="field-even"><p>str</p>
</dd>
<dt class="field-odd">param after_stage<span class="colon">:</span></dt>
<dd class="field-odd"><p>Name of the stage after which this stage should be added.
If None, the stage is added at the end of the LammpsInputFile.</p>
</dd>
<dt class="field-even">type after_stage<span class="colon">:</span></dt>
<dd class="field-even"><p>str</p>
</dd>
</dl>
</section>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.append">
<span class="sig-name descname"><span class="pre">append</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">lmp_input_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile" title="pymatgen.io.lammps.inputs.LammpsInputFile"><span class="pre">LammpsInputFile</span></a></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L476-L502"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.append" title="Link to this definition"></a></dt>
<dd><p>Appends a LammpsInputFile to another. The <cite>stages</cite> are merged,
and the numbering of stages/comments is either kept the same or updated.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>lmp_input_file</strong> (<a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile" title="pymatgen.io.lammps.inputs.LammpsInputFile"><em>LammpsInputFile</em></a>) – LammpsInputFile to append.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.contains_command">
<span class="sig-name descname"><span class="pre">contains_command</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">command</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stage_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L136-L147"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.contains_command" title="Link to this definition"></a></dt>
<dd><p>Get whether a given command is present in the LammpsInputFile.
A stage name can be given; in this case the search will happen only for this stage.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>command</strong> (<em>str</em>) – String with the command to find in the input file (e.g., “units”).</p></li>
<li><p><strong>stage_name</strong> (<em>str</em>) – String giving the stage name where the change should take place.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>True if the command is present, False if not.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>bool</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.from_file">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">path</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">Path</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ignore_comments</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">keep_stages</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L641-L657"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.from_file" title="Link to this definition"></a></dt>
<dd><p>Creates an InputFile object from a file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>path</strong> (<em>str</em><em> or </em><em>path</em>) – Filename to read, including path.</p></li>
<li><p><strong>ignore_comments</strong> (<em>bool</em>) – True if only the commands should be kept from the input file.</p></li>
<li><p><strong>keep_stages</strong> (<em>bool</em>) – True if the block structure from the input file should be kept.
If False, a single block is assumed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>LammpsInputFile</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.from_str">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_str</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">contents</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ignore_comments</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">keep_stages</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L559-L639"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.from_str" title="Link to this definition"></a></dt>
<dd><p>Helper method to parse string representation of LammpsInputFile.
If you created the input file by hand, there is no guarantee that the representation
will be perfect as it is difficult to account for all the cosmetic changes you
could have done on your input script. Always check that you have what you want !
By default, a single stage containing all the input settings is created.
If the block structure of your input file should be kept and stored as
different stages, set keep_stages to True.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>contents</strong> (<em>str</em>) – String representation of LammpsInputFile.</p></li>
<li><p><strong>ignore_comments</strong> (<em>bool</em>) – True if only the commands should be kept from the input file.</p></li>
<li><p><strong>keep_stages</strong> (<em>bool</em>) – True if the block structure from the input file should be kept.
If False, a single block is assumed.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>LammpsInputFile</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.get_args">
<span class="sig-name descname"><span class="pre">get_args</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">command</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stage_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L110-L134"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.get_args" title="Link to this definition"></a></dt>
<dd><p>Given a command, returns the corresponding arguments (or list of arguments) in the LammpsInputFile.
A stage name can be given; in this case the search will happen only for this stage.
If a stage name is not given, the command will be searched for through all of them.
If the command is not found, an empty list is returned.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>command</strong> (<em>str</em>) – String with the command to find in the input file (e.g., “units”).</p></li>
<li><p><strong>stage_name</strong> (<em>str</em>) – String giving the stage name where the change should take place.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>Value of the argument corresponding to the command.
List if the same command is used multiple times.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.get_str">
<span class="sig-name descname"><span class="pre">get_str</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">ignore_comments</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">keep_stages</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">str</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L504-L539"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.get_str" title="Link to this definition"></a></dt>
<dd><p>Generate and ² the string representation of the LammpsInputFile.
Stages are separated by empty lines.
The headers of the stages will be put in comments preceding each stage.
Other comments will be put inline within stages, where they have been added.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>ignore_comments</strong> (<em>bool</em>) – True if only the commands should be kept from the InputFile.</p></li>
<li><p><strong>keep_stages</strong> (<em>bool</em>) – If True, the string is formatted in a block structure with stage names
and newlines that differentiate commands in the respective stages of the InputFile.
If False, stage names are not printed and all commands appear in a single block.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>String representation of the LammpsInputFile.</p>
</dd>
<dt class="field-odd">Return type<span class="colon">:</span></dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.merge_stages">
<span class="sig-name descname"><span class="pre">merge_stages</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stage_names</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L327-L362"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.merge_stages" title="Link to this definition"></a></dt>
<dd><p>Merges multiple stages of a LammpsInputFile together.
The merged stage will be at the same index as the first of the stages to be merged.
The others will appear in the same order as provided in the list. Other non-merged stages will follow.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>stage_names</strong> (<em>list</em>) – list of strings giving the names of the stages to be merged.</p>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.ncomments">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">ncomments</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/inputs.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.ncomments" title="Link to this definition"></a></dt>
<dd><p>The number of comments in the current LammpsInputFile. Includes the blocks of comments as well
as inline comments (comment lines within blocks of LAMMPS commands).</p>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.nstages">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">nstages</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">int</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/inputs.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.nstages" title="Link to this definition"></a></dt>
<dd><p>The number of stages in the current LammpsInputFile.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.remove_command">
<span class="sig-name descname"><span class="pre">remove_command</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">command</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stage_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">]</span></span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">remove_empty_stages</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L428-L474"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.remove_command" title="Link to this definition"></a></dt>
<dd><p>Removes a given command from a given stage. If no stage is given, removes all occurrences of the command.
In case removing a command completely empties a stage, the choice whether to keep this stage in the
LammpsInputFile is given by remove_empty_stages.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>command</strong> (<em>str</em>) – command to be removed.</p></li>
<li><p><strong>stage_name</strong> (<em>str</em><em> or </em><em>list</em>) – names of the stages where the command should be removed.</p></li>
<li><p><strong>remove_empty_stages</strong> (<em>bool</em>) – whether to remove the stages emptied by removing the command or not.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.remove_stage">
<span class="sig-name descname"><span class="pre">remove_stage</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stage_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L296-L307"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.remove_stage" title="Link to this definition"></a></dt>
<dd><p>Removes a whole stage from the LammpsInputFile.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>stage_name</strong> (<em>str</em>) – name of the stage to remove.</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.rename_stage">
<span class="sig-name descname"><span class="pre">rename_stage</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">stage_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">new_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L309-L325"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.rename_stage" title="Link to this definition"></a></dt>
<dd><p>Renames a stage <cite>stage_name</cite> from LammpsInputFile into <cite>new_name</cite>.
First checks that the stage to rename is present, and that
the new name is not already a stage name.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>stage_name</strong> (<em>str</em>) – name of the stage to rename.</p></li>
<li><p><strong>new_name</strong> (<em>str</em>) – new name of the stage.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.set_args">
<span class="sig-name descname"><span class="pre">set_args</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">command</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">argument</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">stage_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">how</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">int</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'all'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L149-L194"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.set_args" title="Link to this definition"></a></dt>
<dd><p>Set the arguments for the given command to the given string.
If the command is not found, nothing is done. Use LammpsInputFile.add_commands instead.
If a stage name is specified, it will be replaced or set only for this stage.
If no stage name is given, it will apply the change in all of them that contain the given command.
If the command is set multiple times in the file/stage, it will be replaced based on “how”:
either the first occurrence, all of them, or the index of the occurrence.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>command</strong> (<em>str</em>) – String representing the command to change, e.g. “units”.</p></li>
<li><p><strong>argument</strong> (<em>str</em>) – String with the new value for the command, e.g. “atomic”.</p></li>
<li><p><strong>stage_name</strong> (<em>str</em>) – String giving the stage name where the change should take place.</p></li>
<li><p><strong>how</strong> (<em>str</em><em> or </em><em>int</em><em> or </em><em>list</em>) – “all” for changing all occurrences of the command within the stage_name
or the whole InputFile, “first” for the first occurrence, int i for the i-th time the command
is present in the stage_name or the whole InputFile, starting at 0. Can be a list of indexes as well.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py property">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.stages_names">
<em class="property"><span class="k"><span class="pre">property</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">stages_names</span></span><em class="property"><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="pre">list</span></em><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/io/lammps/inputs.py"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.stages_names" title="Link to this definition"></a></dt>
<dd><p>List of names for all the stages present in <cite>stages</cite>.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsInputFile.write_file">
<span class="sig-name descname"><span class="pre">write_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">PathLike</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">ignore_comments</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">keep_stages</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L541-L557"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsInputFile.write_file" title="Link to this definition"></a></dt>
<dd><p>Write LAMMPS input file.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>filename</strong> (<em>str</em><em> or </em><em>path</em>) – The filename to output to, including path.</p></li>
<li><p><strong>ignore_comments</strong> (<em>bool</em>) – True if only the commands should be kept from the InputFile.</p></li>
<li><p><strong>keep_stages</strong> (<em>bool</em>) – True if the block structure from the InputFile should be kept.
If False, a single block is assumed.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</section>
</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsRun">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">LammpsRun</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">script_template</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">settings</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><span class="pre">LammpsData</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">script_filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L876-L967"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsRun" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">MSONable</span></code></p>
<p>Examples for various simple LAMMPS runs with given simulation box,
force field and a few more settings. Experienced LAMMPS users should
consider using write_lammps_inputs method with more sophisticated
templates.</p>
<p>Base constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>script_template</strong> (<em>str</em>) – String template for input script
with placeholders. The format for placeholders has to
be ‘$variable_name’, e.g. ‘$temperature’</p></li>
<li><p><strong>settings</strong> (<em>dict</em>) – Contains values to be written to the
placeholders, e.g. {‘temperature’: 1}.</p></li>
<li><p><strong>data</strong> (<a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><em>LammpsData</em></a><em> or </em><em>str</em>) – Data file as a LammpsData
instance or path to an existing data file. Default to
None, i.e., no data file supplied. Useful only when
read_data cmd is in the script.</p></li>
<li><p><strong>script_filename</strong> (<em>str</em>) – Filename for the input script.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsRun.md">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">md</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><span class="pre">LammpsData</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">force_field</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">temperature</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">nsteps</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">other_settings</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsRun" title="pymatgen.io.lammps.inputs.LammpsRun"><span class="pre">LammpsRun</span></a></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L931-L967"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsRun.md" title="Link to this definition"></a></dt>
<dd><p>Example for a simple MD run based on template md.template.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>data</strong> (<a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><em>LammpsData</em></a><em> or </em><em>str</em>) – Data file as a LammpsData
instance or path to an existing data file.</p></li>
<li><p><strong>force_field</strong> (<em>str</em>) – Combined force field related cmds. For
example, ‘pair_style eamnpair_coeff * * Cu_u3.eam’.</p></li>
<li><p><strong>temperature</strong> (<em>float</em>) – Simulation temperature.</p></li>
<li><p><strong>nsteps</strong> (<em>int</em>) – No. of steps to run.</p></li>
<li><p><strong>other_settings</strong> (<em>dict</em>) – other settings to be filled into
placeholders.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsRun.write_inputs">
<span class="sig-name descname"><span class="pre">write_inputs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output_dir</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L910-L929"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsRun.write_inputs" title="Link to this definition"></a></dt>
<dd><p>Write all input files (input script, and data if needed).
Other supporting files are not handled at this moment.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output_dir</strong> (<em>str</em>) – Directory to output the input files.</p></li>
<li><p><strong>**kwargs</strong> – kwargs supported by LammpsData.write_file.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsTemplateGen">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">LammpsTemplateGen</span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L970-L1009"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsTemplateGen" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="pymatgen.io.html#pymatgen.io.template.TemplateInputGen" title="pymatgen.io.template.TemplateInputGen"><code class="xref py py-class docutils literal notranslate"><span class="pre">TemplateInputGen</span></code></a></p>
<p>Create an InputSet object for a LAMMPS run based on a template file.
The input script is constructed by substituting variables into placeholders
in the template file using python’s Template.safe_substitute() function.
The data file containing coordinates and topology information can be provided
as a LammpsData instance. Alternatively, you can include a read_data command
in the template file that points to an existing data file.
Other supporting files are not handled at the moment.</p>
<p>To write the input files to a directory, call LammpsTemplateSet.write_input()
See pymatgen.io.template.py for additional documentation of this method.</p>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.LammpsTemplateGen.get_input_set">
<span class="sig-name descname"><span class="pre">get_input_set</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">script_template</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">PathLike</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">settings</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">script_filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'in.lammps'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><span class="pre">LammpsData</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData" title="pymatgen.io.lammps.data.CombinedData"><span class="pre">CombinedData</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data_filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'system.data'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="pymatgen.io.html#pymatgen.io.core.InputSet" title="pymatgen.io.core.InputSet"><span class="pre">InputSet</span></a></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/inputs.py#L983-L1009"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.LammpsTemplateGen.get_input_set" title="Link to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>script_template</strong> – String template for input script with
placeholders. The format for placeholders has to be
‘$variable_name’, e.g. ‘$temperature’</p></li>
<li><p><strong>settings</strong> – Contains values to be written to the
placeholders, e.g. {‘temperature’: 1}. Default to None.</p></li>
<li><p><strong>data</strong> – Data file as a LammpsData instance. Default to None, i.e., no
data file supplied. Note that a matching ‘read_data’ command
must be provided in the script template in order for the data
file to actually be read.</p></li>
<li><p><strong>script_filename</strong> – Filename for the input file.</p></li>
<li><p><strong>data_filename</strong> – Filename for the data file, if provided.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pymatgen.io.lammps.inputs.write_lammps_inputs">
<span class="sig-name descname"><span class="pre">write_lammps_inputs</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">output_dir</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">script_template</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">settings</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><span class="pre">LammpsData</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">script_filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'in.lammps'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">make_dir_if_not_present</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../../../.venv/lib/python3.11/site-packages/monty/dev.py#L1012-L1116"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.inputs.write_lammps_inputs" title="Link to this definition"></a></dt>
<dd><p>Write input files for a LAMMPS run. Input script is constructed
from a str template with placeholders to be filled by custom
settings. Data file is either written from a LammpsData
instance or copied from an existing file if read_data cmd is
inspected in the input script. Other supporting files are not
handled at the moment.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>output_dir</strong> (<em>str</em>) – Directory to output the input files.</p></li>
<li><p><strong>script_template</strong> (<em>str</em>) – String template for input script with
placeholders. The format for placeholders has to be
‘$variable_name’, e.g. ‘$temperature’</p></li>
<li><p><strong>settings</strong> (<em>dict</em>) – Contains values to be written to the
placeholders, e.g. {‘temperature’: 1}. Default to None.</p></li>
<li><p><strong>data</strong> (<a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><em>LammpsData</em></a><em> or </em><em>str</em>) – Data file as a LammpsData instance or
path to an existing data file. Default to None, i.e., no
data file supplied. Useful only when read_data cmd is in
the script.</p></li>
<li><p><strong>script_filename</strong> (<em>str</em>) – Filename for the input script.</p></li>
<li><p><strong>make_dir_if_not_present</strong> (<em>bool</em>) – Set to True if you want the
directory (and the whole path) to be created if it is not
present.</p></li>
<li><p><strong>**kwargs</strong> – kwargs supported by LammpsData.write_file.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">eam_template</span> <span class="o">=</span> <span class="s1">&#39;&#39;&#39;units           metal</span>
<span class="gp">... </span><span class="s1">atom_style      atomic</span>
<span class="gp">...</span>
<span class="gp">... </span><span class="s1">lattice         fcc 3.615</span>
<span class="gp">... </span><span class="s1">region          box block 0 20 0 20 0 20</span>
<span class="gp">... </span><span class="s1">create_box      1 box</span>
<span class="gp">... </span><span class="s1">create_atoms    1 box</span>
<span class="gp">...</span>
<span class="gp">... </span><span class="s1">pair_style      eam</span>
<span class="gp">... </span><span class="s1">pair_coeff      1 1 Cu_u3.eam</span>
<span class="gp">...</span>
<span class="gp">... </span><span class="s1">velocity        all create $temperature 376847 loop geom</span>
<span class="gp">...</span>
<span class="gp">... </span><span class="s1">neighbor        1.0 bin</span>
<span class="gp">... </span><span class="s1">neigh_modify    delay 5 every 1</span>
<span class="gp">...</span>
<span class="gp">... </span><span class="s1">fix             1 all nvt temp $temperature $temperature 0.1</span>
<span class="gp">...</span>
<span class="gp">... </span><span class="s1">timestep        0.005</span>
<span class="gp">...</span>
<span class="gp">... </span><span class="s1">run             $nsteps&#39;&#39;&#39;</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">write_lammps_inputs</span><span class="p">(</span><span class="s2">&quot;.&quot;</span><span class="p">,</span> <span class="n">eam_template</span><span class="p">,</span> <span class="n">settings</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;temperature&quot;</span><span class="p">:</span> <span class="mf">1600.0</span><span class="p">,</span> <span class="s2">&quot;nsteps&quot;</span><span class="p">:</span> <span class="mi">100</span><span class="p">})</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">&quot;in.lammps&quot;</span><span class="p">,</span> <span class="n">encoding</span><span class="o">=</span><span class="s2">&quot;utf-8&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">file</span><span class="p">:</span>
<span class="gp">... </span>    <span class="n">script</span> <span class="o">=</span> <span class="n">file</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
</pre></div>
</div>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">script</span>
<span class="go">units           metal</span>
<span class="go">atom_style      atomic</span>
</pre></div>
</div>
<p>lattice         fcc 3.615
region          box block 0 20 0 20 0 20
create_box      1 box
create_atoms    1 box</p>
<p>pair_style      eam
pair_coeff      1 1 Cu_u3.eam</p>
<p>velocity        all create 1600.0 376847 loop geom</p>
<p>neighbor        1.0 bin
neigh_modify    delay 5 every 1</p>
<p>fix             1 all nvt temp 1600.0 1600.0 0.1</p>
<p>timestep        0.005</p>
<p>run             100</p>
</dd></dl>

</section>
<section id="module-pymatgen.io.lammps.outputs">
<span id="pymatgen-io-lammps-outputs-module"></span><h2>pymatgen.io.lammps.outputs module<a class="headerlink" href="#module-pymatgen.io.lammps.outputs" title="Link to this heading"></a></h2>
<p>This module implements classes and methods for processing LAMMPS output
files (log and dump).</p>
<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.outputs.LammpsDump">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">LammpsDump</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">timestep</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">natoms</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">box</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox" title="pymatgen.io.lammps.data.LammpsBox"><span class="pre">LammpsBox</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">DataFrame</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/outputs.py#L33-L97"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.outputs.LammpsDump" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">MSONable</span></code></p>
<p>Object for representing dump data for a single snapshot.</p>
<p>Base constructor.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>timestep</strong> (<em>int</em>) – Current time step.</p></li>
<li><p><strong>natoms</strong> (<em>int</em>) – Total number of atoms in the box.</p></li>
<li><p><strong>box</strong> (<a class="reference internal" href="#pymatgen.io.lammps.data.LammpsBox" title="pymatgen.io.lammps.data.LammpsBox"><em>LammpsBox</em></a>) – Simulation box.</p></li>
<li><p><strong>data</strong> (<em>pd.DataFrame</em>) – Dumped atomic data.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.outputs.LammpsDump.as_dict">
<span class="sig-name descname"><span class="pre">as_dict</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">dict</span><span class="p"><span class="pre">[</span></span><span class="pre">str</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">Any</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/outputs.py#L88-L97"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.outputs.LammpsDump.as_dict" title="Link to this definition"></a></dt>
<dd><p>Get MSONable dict.</p>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.outputs.LammpsDump.from_dict">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_dict</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">dct</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/outputs.py#L75-L86"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.outputs.LammpsDump.from_dict" title="Link to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>dct</strong> (<em>dict</em>) – Dict representation.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>LammpsDump</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.outputs.LammpsDump.from_str">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_str</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">string</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/outputs.py#L51-L73"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.outputs.LammpsDump.from_str" title="Link to this definition"></a></dt>
<dd><p>Constructor from string parsing.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>string</strong> (<em>str</em>) – Input string.</p>
</dd>
</dl>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pymatgen.io.lammps.outputs.parse_lammps_dumps">
<span class="sig-name descname"><span class="pre">parse_lammps_dumps</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">file_pattern</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/outputs.py#L100-L127"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.outputs.parse_lammps_dumps" title="Link to this definition"></a></dt>
<dd><p>Generator that parses dump file(s).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>file_pattern</strong> (<em>str</em>) – Filename to parse. The timestep wildcard
(e.g., dump.atom.’*’) is supported and the files are parsed
in the sequence of timestep.</p>
</dd>
<dt class="field-even">Yields<span class="colon">:</span></dt>
<dd class="field-even"><p>LammpsDump for each available snapshot.</p>
</dd>
</dl>
</dd></dl>

<dl class="py function">
<dt class="sig sig-object py" id="pymatgen.io.lammps.outputs.parse_lammps_log">
<span class="sig-name descname"><span class="pre">parse_lammps_log</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'log.lammps'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">list</span><span class="p"><span class="pre">[</span></span><span class="pre">DataFrame</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/outputs.py#L130-L189"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.outputs.parse_lammps_log" title="Link to this definition"></a></dt>
<dd><p>Parses log file with focus on thermo data. Both one and multi line
formats are supported. Any incomplete runs (no “Loop time” marker)
will not be parsed.</p>
<p class="rubric">Notes</p>
<p>SHAKE stats printed with thermo data are not supported yet.
They are ignored in multi line format, while they may cause
issues with dataframe parsing in one line format.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>filename</strong> (<em>str</em>) – Filename to parse.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>[pd.DataFrame] containing thermo data for each completed run.</p>
</dd>
</dl>
</dd></dl>

</section>
<section id="module-pymatgen.io.lammps.sets">
<span id="pymatgen-io-lammps-sets-module"></span><h2>pymatgen.io.lammps.sets module<a class="headerlink" href="#module-pymatgen.io.lammps.sets" title="Link to this heading"></a></h2>
<p>Input sets for LAMMPS.
This InputSet and InputGenerator implementation is based on templates and is not intended to be very flexible.
For instance, pymatgen will not detect whether a given variable should be adapted based on others
(e.g., the number of steps from the temperature), it will not check for convergence nor will it actually run LAMMPS.
For additional flexibility and automation, use the atomate2-lammps implementation
(<a class="reference external" href="https://github.com/Matgenix/atomate2-lammps">https://github.com/Matgenix/atomate2-lammps</a>).</p>
<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.sets.LammpsInputSet">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">LammpsInputSet</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">inputfile</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.inputs.LammpsInputFile" title="pymatgen.io.lammps.inputs.LammpsInputFile"><span class="pre">LammpsInputFile</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="#pymatgen.io.lammps.data.LammpsData" title="pymatgen.io.lammps.data.LammpsData"><span class="pre">LammpsData</span></a><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><a class="reference internal" href="#pymatgen.io.lammps.data.CombinedData" title="pymatgen.io.lammps.data.CombinedData"><span class="pre">CombinedData</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">calc_type</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">template_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">PathLike</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">''</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">keep_stages</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/sets.py#L31-L98"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.sets.LammpsInputSet" title="Link to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="pymatgen.io.html#pymatgen.io.core.InputSet" title="pymatgen.io.core.InputSet"><code class="xref py py-class docutils literal notranslate"><span class="pre">InputSet</span></code></a></p>
<p>Container class for all LAMMPS inputs. This class is intended to provide
general functionality that can be customized to many purposes.
InputGenerator classes elsewhere in this module are used to create
specific instances of LammpsInputSet that are tailored to specific purposes.</p>
<p>/!This InputSet and InputGenerator implementation is based on templates and is not intended to be very flexible.
For instance, pymatgen will not detect whether a given variable should be adapted based on others
(e.g., the number of steps from the temperature), it will not check for convergence nor will it actually run LAMMPS.
For additional flexibility and automation, use the atomate2-lammps implementation
(<a class="reference external" href="https://github.com/Matgenix/atomate2-lammps">https://github.com/Matgenix/atomate2-lammps</a>).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inputfile</strong> – The input file containing settings. It can be a LammpsInputFile object
or a string representation.</p></li>
<li><p><strong>data</strong> – The data file containing structure and topology information.
It can be a LammpsData or a CombinedData object.</p></li>
<li><p><strong>calc_type</strong> – Human-readable string used to briefly describe the type of computations performed by LAMMPS.</p></li>
<li><p><strong>template_file</strong> – Path (string) to the template file used to create the input file for LAMMPS.</p></li>
<li><p><strong>keep_stages</strong> – Whether to keep the stage structure of the LammpsInputFile or not.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.sets.LammpsInputSet.from_directory">
<em class="property"><span class="k"><span class="pre">classmethod</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">from_directory</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">directory</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">PathLike</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">keep_stages</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">Self</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/sets.py#L74-L90"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.sets.LammpsInputSet.from_directory" title="Link to this definition"></a></dt>
<dd><p>Construct a LammpsInputSet from a directory of two or more files.</p>
<p>TODO: accept directories with only the input file, that should include the structure as well.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>directory</strong> – Directory to read input files from. It should contain at least two files:
in.lammps for the LAMMPS input file, and system.data with the system information.</p></li>
<li><p><strong>keep_stages</strong> – Whether to keep the stage structure of the LammpsInputFile or not.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.sets.LammpsInputSet.validate">
<span class="sig-name descname"><span class="pre">validate</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">bool</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/sets.py#L92-L98"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.sets.LammpsInputSet.validate" title="Link to this definition"></a></dt>
<dd><p>A place to implement basic checks to verify the validity of an
input set. Can be as simple or as complex as desired.
Will raise a NotImplementedError unless overloaded by the inheriting class.</p>
</dd></dl>

</dd></dl>

</section>
<section id="module-pymatgen.io.lammps.utils">
<span id="pymatgen-io-lammps-utils-module"></span><h2>pymatgen.io.lammps.utils module<a class="headerlink" href="#module-pymatgen.io.lammps.utils" title="Link to this heading"></a></h2>
<p>This module defines utility classes and functions.</p>
<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.utils.LammpsRunner">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">LammpsRunner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">input_filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'lammps.in'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bin</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'lammps'</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/utils.py#L440-L465"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.utils.LammpsRunner" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>LAMMPS wrapper.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>input_filename</strong> (<em>str</em>) – input file name</p></li>
<li><p><strong>bin</strong> (<em>str</em>) – command to run, excluding the input file name.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.utils.LammpsRunner.run">
<span class="sig-name descname"><span class="pre">run</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">tuple</span><span class="p"><span class="pre">[</span></span><span class="pre">bytes</span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="pre">bytes</span><span class="p"><span class="pre">]</span></span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/utils.py#L459-L465"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.utils.LammpsRunner.run" title="Link to this definition"></a></dt>
<dd><p>Write the input/data files and run LAMMPS.</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.utils.PackmolRunner">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">PackmolRunner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mols</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">param_list</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">list</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">input_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'pack.inp'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tolerance</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">2.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filetype</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'xyz'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">control_params</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">dict</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">auto_box</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">True</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">output_file</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'packed.xyz'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">bin</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'packmol'</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/utils.py#L180-L437"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.utils.PackmolRunner" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Wrapper for the Packmol software that can be used to pack various types of
molecules into a one single unit.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mols</strong> – list of Molecules to pack</p></li>
<li><p><strong>input_file</strong> – name of the packmol input file</p></li>
<li><p><strong>tolerance</strong> – min distance between the atoms</p></li>
<li><p><strong>filetype</strong> – input/output structure file type</p></li>
<li><p><strong>control_params</strong> – packmol control parameters dictionary. Basically
all parameters other than structure/atoms</p></li>
<li><p><strong>param_list</strong> – list of parameters containing dicts for each molecule</p></li>
<li><p><strong>auto_box</strong> – put the molecule assembly in a box</p></li>
<li><p><strong>output_file</strong> – output file name. The extension will be adjusted
according to the filetype.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.utils.PackmolRunner.convert_obatoms_to_molecule">
<span class="sig-name descname"><span class="pre">convert_obatoms_to_molecule</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">atoms</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">Sequence</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">residue_name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">site_property</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'ff_map'</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><span class="pre">Molecule</span></a></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/utils.py#L353-L403"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.utils.PackmolRunner.convert_obatoms_to_molecule" title="Link to this definition"></a></dt>
<dd><p>Convert list of openbabel atoms to Molecule.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>atoms</strong> (<em>[</em><em>OBAtom</em><em>]</em>) – list of OBAtom objects</p></li>
<li><p><strong>residue_name</strong> (<em>str</em>) – the key in self.map_residue_to_mol. Used to
restore the site properties in the final packed molecule.</p></li>
<li><p><strong>site_property</strong> (<em>str</em>) – the site property to be restored.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>Molecule object</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.utils.PackmolRunner.restore_site_properties">
<span class="sig-name descname"><span class="pre">restore_site_properties</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">site_property</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">'ff_map'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><span class="pre">Molecule</span></a></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/utils.py#L405-L437"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.utils.PackmolRunner.restore_site_properties" title="Link to this definition"></a></dt>
<dd><p>Restore the site properties for the final packed molecule.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>site_property</strong> (<em>str</em>)</p></li>
<li><p><strong>filename</strong> (<em>str</em>) – path to the final packed molecule.</p></li>
</ul>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>Molecule</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.utils.PackmolRunner.run">
<span class="sig-name descname"><span class="pre">run</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">site_property</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><span class="pre">Molecule</span></a></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/utils.py#L295-L321"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.utils.PackmolRunner.run" title="Link to this definition"></a></dt>
<dd><p>Write the input file to the scratch directory, run packmol and return
the packed molecule to the current working directory.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>site_property</strong> (<em>str</em>) – if set then the specified site property
for the final packed molecule will be restored.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>Molecule object</p>
</dd>
</dl>
</dd></dl>

<dl class="py method">
<dt class="sig sig-object py" id="pymatgen.io.lammps.utils.PackmolRunner.write_pdb">
<em class="property"><span class="k"><span class="pre">static</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">write_pdb</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">mol</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><span class="pre">Molecule</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">name</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">str</span><span class="w"> </span><span class="p"><span class="pre">|</span></span><span class="w"> </span><span class="pre">None</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">num</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span> <span class="sig-return"><span class="sig-return-icon">&#x2192;</span> <span class="sig-return-typehint"><span class="pre">None</span></span></span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/utils.py#L323-L341"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.utils.PackmolRunner.write_pdb" title="Link to this definition"></a></dt>
<dd><p>Dump the molecule into pdb file with custom residue name and number.</p>
</dd></dl>

</dd></dl>

<dl class="py class">
<dt class="sig sig-object py" id="pymatgen.io.lammps.utils.Polymer">
<em class="property"><span class="k"><span class="pre">class</span></span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">Polymer</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">start_monomer</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><span class="pre">Molecule</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">s_head</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">s_tail</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">monomer</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><span class="pre">Molecule</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">head</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tail</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">end_monomer</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><span class="pre">Molecule</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">e_head</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">e_tail</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">n_units</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">int</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">link_distance</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">float</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">1.0</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">linear_chain</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><span class="pre">bool</span></span><span class="w"> </span><span class="o"><span class="pre">=</span></span><span class="w"> </span><span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/materialsproject/pymatgen/blob/v2025.6.14/src/pymatgen/core/../io/lammps/utils.py#L39-L177"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pymatgen.io.lammps.utils.Polymer" title="Link to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Generate polymer chain via Random walk. At each position there are
a total of 5 possible moves(excluding the previous direction).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>start_monomer</strong> (<a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><em>Molecule</em></a>) – Starting molecule</p></li>
<li><p><strong>s_head</strong> (<em>int</em>) – starting atom index of the start_monomer molecule</p></li>
<li><p><strong>s_tail</strong> (<em>int</em>) – tail atom index of the start_monomer</p></li>
<li><p><strong>monomer</strong> (<a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><em>Molecule</em></a>) – The monomer</p></li>
<li><p><strong>head</strong> (<em>int</em>) – index of the atom in the monomer that forms the head</p></li>
<li><p><strong>tail</strong> (<em>int</em>) – tail atom index. monomers will be connected from
tail to head</p></li>
<li><p><strong>end_monomer</strong> (<a class="reference internal" href="pymatgen.core.html#pymatgen.core.structure.Molecule" title="pymatgen.core.structure.Molecule"><em>Molecule</em></a>) – Terminal molecule</p></li>
<li><p><strong>e_head</strong> (<em>int</em>) – starting atom index of the end_monomer molecule</p></li>
<li><p><strong>e_tail</strong> (<em>int</em>) – tail atom index of the end_monomer</p></li>
<li><p><strong>n_units</strong> (<em>int</em>) – number of monomer units excluding the start and
terminal molecules</p></li>
<li><p><strong>link_distance</strong> (<em>float</em>) – distance between consecutive monomers</p></li>
<li><p><strong>linear_chain</strong> (<em>bool</em>) – linear or random walk polymer chain.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</section>
</section>


           </div>
          </div>
          <footer>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2011, Pymatgen Development Team.</p>
  </div>

  Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
    <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
    provided by <a href="https://readthedocs.org">Read the Docs</a>.
   

</footer>
        </div>
      </div>
    </section>
  </div>
  <script>
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script> 

</body>
</html>
